package com.sunni.service.impl;

import com.sunni.dao_old.RoleDao;
import com.sunni.entity.Role;
import com.sunni.service.RoleService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.stereotype.Component;

import java.util.List;

@Component("roleService")
public class RoleServiceImpl implements RoleService {

    @Autowired
    @Qualifier("roleDao")
    private RoleDao roleDao;

    @Override
    public List<Role> selectAll() {
        return roleDao.selectAll();
    }

    @Override
    public void add(Role role) {
        roleDao.add(role);
    }

    @Override
    public void addTwoRole_testTransaction(Role role1, Role role2) {
        roleDao.add(role1);
        int i = 1/0;
        roleDao.add(role2);
    }
}
